home *** CD-ROM | disk | FTP | other *** search
- #include "../CGVPMacro.csi"
-
- PS20Only
-
- MainInput { uniform sampler2D baseMap : texunit0,
- uniform sampler2D bumpMap : texunit1,
- uniform samplerCUBE normCubeMapHA : texunit2,
- uniform samplerCUBE projMap : texunit3,
- uniform sampler2D attenMap : texunit4,
- uniform float4 Specular }
- DeclarationsScript
- {
- OUT_T0_T1_T2_T3_T4_C0
- FOUT
- }
- CoreScript
- {
- // load the decal
- half4 decalColor = tex2D(baseMap, IN.Tex0.xy);
- // load the bump normal
- float4 bumpNormal = 2*(tex2D(bumpMap, IN.Tex1.xy)-0.5);
- half4 projColor = texCUBE(projMap, IN.Tex3.xyz);
- half atten = saturate((2*(IN.Color.b-0.5)) * -(2*(IN.Color.b-0.5)) + (1-tex2D(attenMap, IN.Tex4.xy).b));
-
- // Half angle vector from normalization cube-map
- float4 hVec = 2*(texCUBE(normCubeMapHA, IN.Tex2.xyz)-0.5);
-
- half NdotH = saturate(dot(hVec.xyz, bumpNormal.xyz));
- half specVal = saturate((NdotH - 0.75)*4);
- specVal = specVal * specVal;
- half3 spec = (specVal * Specular.xyz * atten * projColor.xyz * decalColor.a) * 2;
-
- // finally add them all together
- OUT.Color.xyz = spec;
- OUT.Color.w = Specular.w;
- }
-
-
-